Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: if field has custom decoder, schema takes it into account #462

Merged
merged 15 commits into from
Aug 7, 2023

Conversation

deansg
Copy link
Contributor

@deansg deansg commented Aug 4, 2023

If a field has a custom decoder, replace its _deserialize logic with a dummy method, as it will be taken care of by the decoder.

Attempts to solve #460

deansg and others added 4 commits June 18, 2023 08:59
@deansg
Copy link
Contributor Author

deansg commented Aug 4, 2023

This is just an initial version. I'd like to know if I'm in the right direction or if this isn't it.

Copy link
Collaborator

@george-zubrienko george-zubrienko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

Minor comments, I don't think the approach is wrong, but I'm also not very strong on marshmellow side, so a bit of explanation of this solution would be nice :)

dataclasses_json/mm.py Outdated Show resolved Hide resolved
dataclasses_json/mm.py Outdated Show resolved Hide resolved
dataclasses_json/mm.py Outdated Show resolved Hide resolved
@deansg
Copy link
Contributor Author

deansg commented Aug 7, 2023

@george-zubrienko I reverted all formatting changes except for a single line which only contained spaces which PyCharm just won't let me change back, I hope it's not a deal breaker.
I also added an extended comment explaining the change.
Let me know if you have more comments.

Copy link
Collaborator

@george-zubrienko george-zubrienko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, nice and clear! Thanks a lot for fixing this bug!

@george-zubrienko george-zubrienko merged commit 04ddea8 into lidatong:master Aug 7, 2023
9 checks passed
@deansg deansg deleted the schema_decoder branch August 8, 2023 05:38
deansg added a commit to deansg/dataclasses-json that referenced this pull request Aug 9, 2023
Fix: if field has custom decoder, schema takes it into account (lidatong#462)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Generated schema doesn't take into account custom decoder
2 participants